package net.huashitong.Indicators.service;

import com.sirdc.modules.core.dao.BaseDao;
import com.sirdc.modules.core.dao.GenericQuery;
import com.sirdc.modules.sys.base.StringPKService;
import com.sirdc.modules.sys.service.SysTableService;
import net.huashitong.Indicators.dao.AppMsgGroupDao;
import net.huashitong.Indicators.entity.AppMsgGroup;
import net.huashitong.Indicators.filter.AppMessageFilter;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class AppMsgGroupService extends StringPKService<AppMsgGroup> {

    @Autowired
    private AppMsgGroupDao dao;
    @Autowired
    private SysTableService tableService;
    @Override
    protected BaseDao<AppMsgGroup, String> getDao() {
        return dao;
    }
    @Override
    protected void beforeSave(AppMsgGroup obj) {
        obj.setSysId(tableService.updateMaxSysId("app_msg_group", null));
    }


    /**
     * 根据分组创建时间倒叙查询
     * @return
     */
    public List<AppMsgGroup> queryByOrderCreateDate(){
        return dao.queryByOrderCreateDate();
    }

    public List<AppMsgGroup> queryByFilter(AppMessageFilter filter){
        return dao.queryByFilter(filter);
    }
}
